﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace QuanLiBongDa.DataAccessLayer
{
    class SanDAO
    {
        public static SanDAO CreateSanDAO()
        {
            return new SanDAO();
        }
        public bool Insert_San(SanDTO s)
        {
            SqlParameter[] par = new SqlParameter[2];
            par[0] = new SqlParameter("@MaSan", s.MaSan);
            par[1] = new SqlParameter("@TenSan",s.TenSan);
            return SQLService.mmExecuteNonquery("Insert_San", par);
        }
        public bool Update_San(SanDTO s)
        {
            SqlParameter[] par = new SqlParameter[2];
            par[0] = new SqlParameter("@MaSan", s.MaSan);
            par[1] = new SqlParameter("@TenSan", s.TenSan);
            return SQLService.mmExecuteNonquery("Update_San", par);
        }
        public bool Delete_San(SanDTO s)
        {
            SqlParameter[] par = new SqlParameter[1];
            par[0] = new SqlParameter("@MaSan", s.MaSan);
            return SQLService.mmExecuteNonquery("Delete_San", par);
        }
        public DataTable TimMS_Ten(string tensan)
        {
            SqlParameter[] par = new SqlParameter[1];
            par[0] = new SqlParameter("@tensan", tensan);
            return SQLService.FillTable("TimMS_Ten", par);
        }
    }
}
